/* ===== 变量定义 ===== */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --info: #4895ef;
    --warning: #f77f00;
    --danger: #e63946;
    --light: #f8f9fa;
    --dark: #212529;
    --card-bg: #ffffff;
    --body-bg: #f0f2f5;
}

/* ===== 基本样式 ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--dark);
    padding: 0;
    margin: 0;
}

.container-fluid {
    padding: 0;
}

/* ===== 头部样式 ===== */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.app-title {
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
}

/* ===== 分栏布局 ===== */
.split-view-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 80vh;
    gap: 15px;
}

.split-panel {
    flex: 1;
    min-width: 0; /* 防止内容溢出 */
    overflow: hidden;
}

/* ===== 卡片样式 ===== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    background-color: var(--card-bg);
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card.h-100 {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    border-top-left-radius: 10px !important;
    border-top-right-radius: 10px !important;
}

.card-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* ===== 表单元素样式 ===== */
.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.6rem 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
}

.form-select {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.6rem 1rem;
    transition: all 0.2s;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
}

.param-container {
    background-color: rgba(67, 97, 238, 0.03);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary);
}

/* 确保最终URL显示完整 */
#finalUrl {
    width: 100%;
    overflow: auto;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ===== 按钮样式 ===== */
.btn {
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--secondary);
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.send-btn-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ===== 方法徽章样式 ===== */
.method-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    margin-right: 0.75rem;
    min-width: 60px;
    text-align: center;
}

.method-get {
    background-color: #4cc9f0;
}

.method-post {
    background-color: #3a86ff;
}

.method-put {
    background-color: #ffc300;
}

.method-delete {
    background-color: #ff006e;
}

/* ===== 响应显示区域样式 ===== */
.response-container {
    margin-top: 1rem;
}

pre {
    background-color: #343a40;
    color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    max-height: 400px;
    overflow: auto;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    width: 100%;
    overflow-x: auto;
}

/* ===== 标签页样式 ===== */
.nav-tabs {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.nav-tabs .nav-link {
    border: none;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    margin-right: 0.5rem;
    transition: all 0.2s;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    background-color: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    background-color: rgba(67, 97, 238, 0.05);
}

.tab-content {
    margin-top: 10px;
}

.tab-pane {
    width: 100%;
}

/* ===== 提示框样式 ===== */
.alert {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.alert i {
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 响应式调整 ===== */
@media (max-width: 991.98px) {
    .card-header, .card-body {
        padding: 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
    }

    pre {
        font-size: 0.8rem;
    }
}

@media (max-width: 767.98px) {
    .app-header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
}

/* 在小屏幕上调整布局为上下排列 */
@media (max-width: 576px) {
    .split-view-container {
        flex-direction: column;
    }

    .split-panel {
        width: 100%;
    }
}

/* JSON文件控制按钮 */
.json-file-controls {
    display: flex;
    align-items: center;
}

.json-file-controls button {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    padding: 0.3rem 0.8rem;
}

#currentFileName {
    font-style: italic;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 文件加载后的效果 */
.file-loaded #requestBody {
    border-color: #4cc9f0; /* 直接使用颜色值替代变量 */
    background-color: rgba(76, 201, 240, 0.03);
}
